<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div class="full-center-content-scroll-noheader ">
			<h:form id="form3">
				<p:growl id="msgs" showDetail="true" />
				<p:toolbar id="btnBar">
					<f:facet name="left">
						<p:commandButton value="新增" id="createBtn"
							oncomplete="PF('createDlg').show()" actionListener="#{standardLibraryController.preCreate()}"
							update="cereaForm:createDlg" icon="fa fa-plus" />
						<p:commandButton value="编辑" id="editBtn"
							disabled="#{standardLibraryController.selected==null}" oncomplete="PF('createDlg').show()"
							process="@this" actionListener="#{standardLibraryController.preUpdate()}"
							update="cereaForm:createDlg" icon="fa fa-pencil" />
						<p:commandButton value="删除" id="delBtn"
							disabled="#{standardLibraryController.selected==null}"
							actionListener="#{standardLibraryController.delete()}"
							update="form3:msgs form3:configTb form3:delBtn form3:editBtn" icon="fa fa-trash">
							<p:confirm header="提示" message="确定要删除么？" icon="ui-icon-alert" />
						</p:commandButton>
					</f:facet>
					
				</p:toolbar>
				<p:dataTable id="configTb" var="record" emptyMessage="无记录" 
					value="#{standardLibraryController.records}" rowKey="#{record.id}"
					paginator="true" paginatorPosition="bottom"
					paginatorTemplate="{Customertion} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rows="20" rowsPerPageTemplate="20,50,100" rowIndexVar="ite"
					selection="#{standardLibraryController.selected}"
					style="margin-bottom:20px;text-align: center">
					<f:facet name="{Customertion}">
             			<p:outputLabel value="总计：#{standardLibraryController.records.size()}条纪录" style="margin-right:20px"/>
             		</f:facet>
					<p:ajax event="rowSelectRadio" update="form3:btnBar " />
					<p:column selectionMode="single" style="width:60px" />
					<p:column headerText="序号" style="width:64px;">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="名称" style="width:50%;text-align:left;">
						<h:outputText value="#{record.name}"  />
					</p:column>
					<p:column headerText="类型" style="width:20%;">
						<h:outputText value="#{standardLibraryController.getDescByCode(record.recordType)}" />
					</p:column>
					<p:column headerText="匹配方式" style="width:15%;">
						<h:outputText value="#{record.regexType==false?'正向匹配':'反向匹配'}" />
					</p:column>
					<p:column headerText="备注" style="width:15%;">
						<h:outputText value="#{record.description}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="cereaForm">
				<p:dialog id="createDlg" widgetVar="createDlg" header="#{standardLibraryController.current.id==null?'新建':'编辑'} " modal="true" width="600"
					height="300">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" style="float: right;" icon="fa fa-floppy-o"
								update="form3:configTb form3:msgs form3:delBtn form3:editBtn form3:createBtn"
								actionListener="#{standardLibraryController.save()}" oncomplete="PF('createDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="createDetail" style="text-align:center;">
						<p:panelGrid columns="2" style="width:100%">
							<h:outputText value="序号" />
							<p:inputText value="#{standardLibraryController.current.recordOrder}" style="width:100%" ></p:inputText>
							<h:outputText value="名称" />
							<h:inputTextarea  label="name" style="width:100%" value="#{standardLibraryController.current.name}" required="true"
								requiredMessage="名称为必填项"></h:inputTextarea >
							<h:outputText value="类型" />
							<p:selectOneMenu value="#{standardLibraryController.current.recordType}" style="width:100%">
								<f:selectItem itemLabel="Select One" itemValue="" />
            					<f:selectItems value="#{standardLibraryController.recordTypes}" />
							</p:selectOneMenu>
							<h:outputText value="匹配方式" />
							<p:selectBooleanButton  value="#{standardLibraryController.current.regexType}" onLabel="反向匹配" offLabel="正向匹配" style="width:100%" />
							<h:outputText value="备注" />
							<p:inputText style="width:100%" value="#{standardLibraryController.current.description}"></p:inputText>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/plugins/datatables/jquery.dataTables.js"></script>
		<script src="/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="/resources/js/tables/mytable.js"></script>
		<script src="/resources/js/mymodal.js"></script>
	</ui:define>
</ui:composition>
